//base64加密开始
var keyStr = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef" + "ghijklmnopqrstuv" + "wxyz0123456789+/" + "=";
function encode64(input) {
        var output = "";
        var chr1, chr2, chr3 = "";
        var enc1, enc2, enc3, enc4 = "";
        var i = 0;
        do {
                chr1 = input.charCodeAt(i++);
                chr2 = input.charCodeAt(i++);
                chr3 = input.charCodeAt(i++);
                enc1 = chr1 >> 2;
                enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
                enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
                enc4 = chr3 & 63;
                if (isNaN(chr2)) {
                        enc3 = enc4 = 64;
                } else if (isNaN(chr3)) {
                        enc4 = 64;
                }
                output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2)
                                + keyStr.charAt(enc3) + keyStr.charAt(enc4);
                chr1 = chr2 = chr3 = "";
                enc1 = enc2 = enc3 = enc4 = "";
        } while (i < input.length);

        return output;
}
// base64加密结束

$(function(){ 
	//文本框只能输入数字，并屏蔽输入法和粘贴  
	$.fn.numeral = function() {     
           $(this).css("ime-mode", "disabled");     
           this.bind("keypress",function(e) {     
           var code = (e.keyCode ? e.keyCode : e.which);  //兼容火狐 IE      
               if(!$.browser.msie&&(e.keyCode==0x8))  //火狐下不能使用退格键     
               {     
                    return ;     
                   }     
                   return code >= 48 && code<= 57;     
           });     
           this.bind("blur", function() {     
               if (this.value.lastIndexOf(".") == (this.value.length - 1)) {     
                   this.value = this.value.substr(0, this.value.length - 1);     
               } else if (isNaN(this.value)) {     
                   this.value = "";     
               }     
           });     
           this.bind("paste", function() {     
               var s = clipboardData.getData('text');     
               if (!/\D/.test(s));     
               value = s.replace(/^0*/, '');     
               return false;     
           });     
           this.bind("dragenter", function() {     
               return false;     
           });     
           this.bind("keyup", function() {     
           // if (/(^0+)/.test(this.value)) {     
            //   this.value = this.value.replace(/^0*/, '');     
              // }     
           });     
	};
	
});

